package com.seata.controller;

import com.seata.model.Storage;
import com.seata.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: TongRui乀
 * @Date: 2019-12-05 17:10
 * @description：
 */
@RestController
@RequestMapping("storage")
public class StorageController {

    @Autowired
    private StorageService storageService;

    @PostMapping("decreaseStorage")
    public Integer decreaseStorage(@RequestBody Storage storage){
        return this.storageService.decreaseStorage(storage);
    }

    @GetMapping("getStorageById")
    public Storage getStorageById(Integer id){
        return this.storageService.getById(id);
    }
}
